﻿using UnityEngine;
using System.Collections;

public class InGameHUD : MonoBehaviour {


	public GameObject pauseButton;
	public PasueMenu pauseMenu;
	// Use this for initialization

	void Start () 
	{
		Vector3 pausePos = pauseButton.transform.position;
		float screenRightEdge = Camera.main.aspect * Camera.main.orthographicSize;
		pausePos.x = screenRightEdge - 0.5f;
		pauseButton.transform.position = pausePos;
	}
	
	void OnPause()
	{
		GameManager.Game.IsPaused = true;
		pauseMenu.Activate ();
	}

	void Update()
	{
		bool showPauseButton = !GameManager.Game.IsPaused && !GameManager.Game.IsGameOver;
		if (showPauseButton != pauseButton.activeSelf)
			pauseButton.SetActive (showPauseButton);
	}
}
